home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / AIncludes / Sound.a < prev    next >
Encoding:
Text File  |  1993-11-30  |  11.8 KB  |  413 lines  |  [TEXT/MPS ]

  1. ;    File:        Sound.a
  2. ;
  3. ;    Copyright:    © 1983-1993 by Apple Computer, Inc.
  4. ;                All rights reserved.
  5. ;
  6. ;    Version:    System 7.1 for ETO #11
  7. ;    Created:    Tuesday, March 30, 1993 18:00
  8. ;
  9. ;___________________________________________________________________________
  10.  
  11.     IF &TYPE('__INCLUDINGSOUND__') = 'UNDEFINED' THEN
  12. __INCLUDINGSOUND__    SET    1
  13.  
  14.  
  15. ; _______________________________________________________________________
  16. ; Sound Driver
  17. ; _______________________________________________________________________
  18.  
  19. swMode             EQU -1
  20. ftMode             EQU 1
  21. ffMode             EQU 0
  22.  
  23. FFSynthRec        RECORD 0
  24. mode            DS.W 1
  25. count            DS.L 1
  26. waveBytes        DS.B 30001
  27.                 ENDR
  28.  
  29. Tone            RECORD 0
  30. count            DS.W 1
  31. amplitude        DS.W 1
  32. duration        DS.W 1
  33. toneRecSize        EQU *
  34.                 ENDR
  35.  
  36. SWSynthRec        RECORD 0
  37. mode            DS.W 1
  38. triplets        DS.B 5001*Tone.toneRecSize
  39.                 ENDR
  40.  
  41. FTSoundRec        RECORD 0
  42. duration        DS.W 1
  43. sound1Rate        DS.L 1
  44. sound1Phase        DS.L 1
  45. sound2Rate        DS.L 1
  46. sound2Phase        DS.L 1
  47. sound3Rate        DS.L 1
  48. sound3Phase        DS.L 1
  49. sound4Rate        DS.L 1
  50. sound4Phase        DS.L 1
  51. sound1Wave        DS.L 1
  52. sound2Wave        DS.L 1
  53. sound3Wave        DS.L 1
  54. sound4Wave        DS.L 1
  55.                 ENDR
  56.  
  57. FTSynthRec        RECORD 0
  58. mode            DS.W 1
  59. sndRec            DS.L 1
  60.                 ENDR
  61. ; _______________________________________________________________________
  62. ; Sound Manager constants
  63. ; _______________________________________________________________________
  64.  
  65. synthCodeRsrc             EQU 'snth'
  66. soundListRsrc             EQU 'snd '
  67.  
  68. rate22khz                EQU $56EE8BA3        ; 22254.54545
  69. rate11khz                EQU $2B7745D1        ; 11127.27273
  70.  
  71. ; synthesizer numbers for SndNewChannel
  72.  
  73. squareWaveSynth         EQU 1            ; square wave synthesizer
  74. waveTableSynth             EQU 3             ; wave table synthesizer
  75. sampledSynth             EQU 5            ; sampled sound synthesizer
  76.  
  77. ; Command Numbers
  78.  
  79. nullCmd                 EQU 0
  80. initCmd                 EQU 1
  81. freeCmd                 EQU 2
  82. quietCmd                 EQU 3
  83. flushCmd                 EQU 4
  84. reInitCmd                 EQU 5
  85.  
  86. waitCmd                 EQU 10
  87. pauseCmd                 EQU 11
  88. resumeCmd                 EQU 12
  89. callBackCmd             EQU 13
  90. syncCmd                 EQU 14
  91. emptyCmd                 EQU 15
  92.  
  93. tickleCmd                 EQU 20
  94. requestNextCmd             EQU 21
  95. howOftenCmd             EQU 22
  96. wakeUpCmd                 EQU 23
  97. availableCmd             EQU 24
  98. versionCmd                 EQU 25
  99. totalLoadCmd             EQU 26
  100. loadCmd                 EQU 27
  101.  
  102. scaleCmd                 EQU 30
  103. tempoCmd                 EQU 31
  104.  
  105. freqDurationCmd         EQU 40
  106. restCmd                 EQU 41
  107. freqCmd                 EQU 42
  108. ampCmd                     EQU 43
  109. timbreCmd                 EQU 44
  110. getAmpCmd                EQU 45
  111. waveTableCmd             EQU 60
  112. phaseCmd                 EQU 61
  113.  
  114. soundCmd                 EQU 80
  115. bufferCmd                 EQU 81
  116. rateCmd                 EQU 82
  117. continueCmd             EQU 83
  118. doubleBufferCmd         EQU 84
  119. getRateCmd                 EQU 85
  120.  
  121. sizeCmd                 EQU 90
  122. convertCmd                 EQU 91
  123.  
  124. stdQLength                 EQU 128
  125. dataOffsetFlag             EQU $8000
  126.  
  127. waveInitChannelMask        EQU $07
  128. waveInitChannel0        EQU $04
  129. waveInitChannel1        EQU $05
  130. waveInitChannel2        EQU $06
  131. waveInitChannel3        EQU $07
  132.  
  133. ; channel initialization parameters
  134.  
  135. initPanMask                EQU $0003        ; mask for right/left pan values
  136. initSRateMask             EQU $0030        ; mask for sample rate values
  137. initStereoMask             EQU $00C0        ; mask for mono/stereo values
  138. initCompMask            EQU $FF00        ; mask for compression IDs
  139.  
  140. initChanLeft             EQU $0002        ; left stereo channel
  141. initChanRight             EQU $0003        ; right stereo channel
  142. initSRate22k             EQU $0020        ; 22k sampling rate
  143. initMono                 EQU $0080        ; monophonic channel
  144. initStereo                 EQU $00C0        ; stereo channel
  145. initNoInterp             EQU $0004        ; no linear interpolation
  146. initNoDrop                EQU $0008        ; no drop-sample conversion
  147. initMACE3                 EQU $0300        ; MACE 3:1
  148. initMACE6                 EQU $0400        ; MACE 6:1
  149.  
  150. initChan0                 EQU $0004        ; channel 0 - wave table only
  151. initChan1                 EQU $0005        ; channel 1 - wave table only
  152. initChan2                 EQU $0006        ; channel 2 - wave table only
  153. initChan3                 EQU $0007        ; channel 3 - wave table only
  154.  
  155. stdSH                     EQU $0
  156. extSH                     EQU $FF
  157. cmpSH                     EQU $FE
  158.  
  159. notCompressed             EQU 0
  160. twoToOne                 EQU 1
  161. eightToThree             EQU 2
  162. threeToOne                 EQU 3
  163. sixToOne                 EQU 4
  164.  
  165. outsideCmpSH             EQU 0
  166. insideCmpSH             EQU 1
  167. aceSuccess                 EQU 0
  168. aceMemFull                 EQU 1
  169. aceNilBlock             EQU 2
  170. aceBadComp                 EQU 3
  171. aceBadEncode             EQU 4
  172. aceBadDest                 EQU 5
  173. aceBadCmd                 EQU 6
  174. sixToOnePacketSize         EQU 8
  175. threeToOnePacketSize     EQU 16
  176. stateBlockSize             EQU 64
  177. leftOverBlockSize         EQU 32
  178.  
  179. firstSoundFormat         EQU 1
  180. secondSoundFormat         EQU 2
  181.  
  182. dbBufferReady             EQU $00000001
  183. dbLastBuffer             EQU $00000004
  184.  
  185. sysBeepDisable            EQU $0000
  186. sysBeepEnable            EQU $0001
  187.  
  188. unitTypeNoSelection        EQU $FFFF
  189. unitTypeSeconds            EQU $0000
  190.  
  191.  
  192. noneCompType            EQU 'NONE'        ; use no compression on samples
  193. MACE3CompType            EQU 'MAC3'        ; use MACE 3:1 compression on samples
  194. MACE6CompType            EQU 'MAC6'        ; use MACE 6:1 compression on samples
  195.  
  196.  
  197. ; _______________________________________________________________________
  198. ; Sound Manager structures
  199. ; _______________________________________________________________________
  200.  
  201. SndCommand            RECORD 0
  202. cmd                   DS.W 1             ; INTEGER
  203. param1                DS.W 1             ; INTEGER
  204. param2                DS.L 1             ; LONGINT
  205. sndCSize              EQU *             ; size of SndCommand
  206.                       ENDR
  207.  
  208. SndChannel            RECORD 0
  209. nextChan              DS.L 1             ; ^SndChannel
  210. firstMod              DS.L 1             ; Ptr
  211. callBack              DS.L 1             ; ProcPtr
  212. userInfo              DS.L 1
  213.  
  214. ; The following is for internal Sound Manager use only.
  215.  
  216. wait                  DS.L 1             ; Time [LONGINT]
  217. cmdInProgress         DS SndCommand 
  218. flags                 DS.W 1             ; INTEGER
  219. qLength               DS.W 1             ; INTEGER
  220. qHead                 DS.W 1             ; INTEGER
  221. qTail                 DS.W 1             ; INTEGER
  222. queue                 DS.B stdQLength*SndCommand.sndCSize
  223. sndChSize             EQU *             ; size of SndChannel
  224.                       ENDR
  225.  
  226. SoundHeader           RECORD 0
  227. samplePtr             DS.L 1             ; Ptr - if NIL then samples are in sampleArea
  228. length                DS.L 1             ; LONGINT
  229. sampleRate            DS.L 1             ; Fixed
  230. loopStart             DS.L 1             ; LONGINT
  231. loopEnd               DS.L 1             ; LONGINT
  232. baseFrequency          DS.W 1             ; INTEGER
  233. sampleArea            DS.B 1             ; PACKED ARRAY [0..0] OF Byte
  234.                     align
  235. size                EQU     *             ; size of this entire record
  236.                       ENDR
  237.  
  238. SMStatus            RECORD 0
  239. smMaxCPULoad        DS.W 1
  240. smNumChannels        DS.W 1
  241. smCurCPULoad        DS.W 1
  242.                     ENDR
  243.  
  244. SCStatus            RECORD 0
  245. scStartTime            DS.L 1
  246. scEndTime            DS.L 1
  247. scCurrentTime        DS.L 1
  248. scChannelBusy        DS.B 1
  249. scChannelDisposed    DS.B 1
  250. scChannelPaused        DS.B 1
  251. scUnused            DS.B 1
  252. scChannelAttributes    DS.L 1
  253. scCPULoad            DS.L 1
  254.                     ENDR
  255.  
  256. AudioSelection        RECORD 0
  257. unitType            DS.L 1
  258. selStart            DS.L 1        ; Fixed; 
  259. selEnd                DS.L 1        ; Fixed; 
  260.                     ENDR
  261.  
  262. SndDoubleBuffer        RECORD 0
  263. dbNumFrames            DS.L 1
  264. dbFlags                DS.L 1
  265. dbUserInfo            DS.L 2
  266. dbSoundData            EQU *                        
  267.                     ENDR
  268.  
  269. SndDoubleBufferHeader    RECORD 0
  270. dbhNumChannels            DS.W 1
  271. dbhSampleSize            DS.W 1
  272. dbhCompressionID        DS.W 1
  273. dbhPacketSize            DS.W 1
  274. dbhSampleRate            DS.L 1
  275. dbhBufferPtr            DS.L 2
  276. dbhDoubleBack            DS.L 1
  277. SndDoubleBufferHeaderSz    EQU  *                        
  278.                         ENDR
  279.  
  280. ; _______________________________________________________________________
  281. ; MACE structures
  282. ; _______________________________________________________________________
  283.  
  284.  
  285. LeftOverBlock        RECORD 0
  286. count                DS.L 1
  287. sampleArea            DS.B leftOverBlockSize
  288.                     ENDR
  289.  
  290. CmpSoundHeader         RECORD 0
  291. samplePtr            DS.L 1            ; if NIL then samples are in sampleArea
  292. numChannels            DS.L 1            ; number of channels  mono = 1
  293. sampleRate            DS.L 1            ; sample rate in Apples Fixed point representation
  294. loopStart            DS.L 1            ; loopStart of sound before compression
  295. loopEnd                DS.L 1            ; loopEnd of sound before compression
  296. encode                DS.B 1            ; data structure used ,  stdSH, extSH, or cmpSH
  297. baseFrequency        DS.B 1            ; same meaning as regular SoundHeader
  298. numFrames            DS.L 1            ; length in frames    ( packetFrames or sampleFrames
  299. AIFFSampleRate        DS.B 10            ; IEEE sample rate EXTENDED number
  300. markerChunk            DS.L 1            ; sync track
  301. futureUse1            DS.L 1            ; reserved by Apple
  302. futureUse2            DS.L 1            ; reserved by Apple
  303. stateVars            DS.L 1            ; pointer to State Block
  304. leftOverSamples        DS.L 1            ; used to save truncated samples between compression calls
  305. compressionID        DS.W 1            ; 0 means no compression, non zero means compressionID
  306. packetSize            DS.W 1            ; number of bits in compressed sample packet
  307. snthID                DS.W 1            ; Resource ID of Sound Manager snth that contains NRT C/E
  308. sampleSize            DS.W 1            ; number of bits in non-compressed sample
  309. sampleArea            DS.B 1             ; PACKED ARRAY [0..0] OF Byte
  310.                     align
  311. size                EQU     *             ; size of this entire record
  312.                     ENDR
  313.  
  314. ExtSoundHeader         RECORD 0
  315. samplePtr            DS.L 1            ; if NIL then samples are in sampleArea
  316. numChannels            DS.L 1            ; number of channels  mono = 1
  317. sampleRate            DS.L 1            ; sample rate in Apples Fixed point representation
  318. loopStart            DS.L 1            ; loopStart of sound before compression
  319. loopEnd                DS.L 1            ; loopEnd of sound before compression
  320. encode                DS.B 1            ; data structure used ,  stdSH, extSH, or cmpSH
  321. baseFrequency        DS.B 1            ; same meaning as regular SoundHeader
  322. numFrames            DS.L 1            ; length in total number of frames
  323. AIFFSampleRate        DS.B 10            ; IEEE sample rate
  324. markerChunk            DS.L 1            ; sync track
  325. instrumentChunks    DS.L 1
  326. AESRecording        DS.L 1
  327. sampleSize            DS.W 1            ; number of bits in sample
  328. futureUse1            DS.W 1            ; reserved by Apple
  329. futureUse2            DS.L 1            ; reserved by Apple
  330. futureUse3            DS.L 1            ; reserved by Apple
  331. futureUse4            DS.L 1            ; reserved by Apple
  332. sampleArea            DS.B 1             ; PACKED ARRAY [0..0] OF Byte
  333.                     align
  334. size                EQU     *             ; size of this entire record
  335.                     ENDR
  336.  
  337. ; _______________________________________________________________________
  338. ; Sound Input
  339. ; _______________________________________________________________________
  340.  
  341. siDeviceIsConnected        EQU 1            ; input device is connected and ready for input
  342. siDeviceNotConnected    EQU 0            ; input device is not connected
  343. siDontKnowIfConnected    EQU -1            ; can't tell if input device is connected
  344.  
  345.  
  346. ; Info Selectors for the SPBGetDeviceInfo and SPBSetDeviceInfo calls
  347.  
  348. siDeviceConnected        EQU 'dcon'        ; input device connection status
  349. siAGCOnOff                EQU 'agc '        ; automatic gain control state
  350. siPlayThruOnOff            EQU 'plth'        ; playthrough state
  351. siTwosComplementOnOff    EQU 'twos'        ; two's complement state
  352. siLevelMeterOnOff        EQU 'lmet'        ; level meter state
  353. siRecordingQuality        EQU 'qual'        ; recording quality
  354. siVoxRecordInfo            EQU 'voxr'        ; VOX record parameters
  355. siVoxStopInfo            EQU 'voxs'        ; VOX stop parameters
  356. siNumberChannels        EQU 'chan'        ; current number of channels
  357. siSampleSize            EQU 'ssiz'        ; current sample size
  358. siSampleRate            EQU 'srat'        ; current sample rate
  359. siCompressionType        EQU 'comp'        ; current compression type
  360. siCompressionFactor        EQU 'cmfa'        ; current compression factor
  361. siCompressionHeader        EQU 'cmhd'        ; return compression header
  362. siDeviceName            EQU 'name'        ; input device name
  363. siDeviceIcon            EQU 'icon'        ; input device icon
  364. siDeviceBufferInfo        EQU 'dbin'        ; size of interrupt buffer
  365. siSampleSizeAvailable    EQU 'ssav'        ; sample sizes available
  366. siSampleRateAvailable    EQU 'srav'        ; sample rates available
  367. siCompressionAvailable    EQU 'cmav'        ; compression types available
  368. siChannelAvailable        EQU 'chav'        ; number of channels available
  369. siAsync                    EQU 'asyn'        ; asynchronous capability
  370. siOptionsDialog            EQU 'optd'        ; display options dialog
  371. siContinuous            EQU 'cont'        ; continous recording
  372. siActiveChannels        EQU 'chac'        ; active channels
  373. siActiveLevels            EQU 'lmac'        ; active meter levels
  374. siInputSource            EQU 'sour'        ; input source selector
  375. siInitializeDriver        EQU 'init'        ; reserved for internal use only
  376. siCloseDriver            EQU 'clos'        ; reserved for internal use only
  377. siPauseRecording        EQU 'paus'        ; reserved for internal use only
  378. siUserInterruptProc        EQU 'user'        ; reserved for internal use only
  379.  
  380. ; Quality Selectors for the SndRecord and SndRecordToFile calls
  381.  
  382. siBestQuality            EQU 'best'
  383. siBetterQuality            EQU 'betr'
  384. siGoodQuality            EQU 'good'
  385.  
  386. ; Sound Input Parameter Block (SPB)
  387.  
  388. SInParam            RECORD 0
  389. inRefNum            DS.L 1            ; pointer to Application Reference Block
  390. count                DS.L 1            ; the # of bytes to read
  391. milliseconds        DS.L 1            ; the # of ms of sound to read
  392. bufferLength        DS.L 1            ; length of input buffer
  393. inputBuffer            DS.L 1            ; pointer to input buffer
  394. completionRoutine    DS.L 1            ; procPtr to the user completion routine
  395. interruptRoutine    DS.L 1            ; procPtr to the user interrupt routine
  396. userLong            DS.L 1            ; reserved for user data
  397. error                DS.W 1            ; OSErr will be returned to asynch routines
  398. unused1                DS.L 1            ; reserved for future expansion - must be zero
  399. SInPARAMSize        EQU *            ; size of SInParam
  400.                     ENDR
  401.  
  402.  
  403.     ENDIF    ; ...already included